<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
        <h1>Hello</h1>
        <p>
            <span sec:authorize="isAuthenticated()">
                名字：<span sec:authentication="name"></span>
                权限：<span sec:authentication="principal.getAuthorities()"></span>
            </span>
        </p>
        <p>
            <span sec:authorize="isAuthenticated()">
                <a th:href="@{/logout}">注销</a>
            </span>|
            <span sec:authorize="!isAuthenticated()">
                 <a th:href="@{/toLogin}">登录</a>
            </span>
        </p>
        <p sec:authorize="hasRole('vip1')">
            <a th:href="@{/level1/1}">level1-1</a>
            <a th:href="@{/level1/2}">level1-2</a>
            <a th:href="@{/level1/3}">level1-3</a>
        </p>

        <p sec:authorize="hasRole('vip2')">
            <a th:href="@{/level2/1}">level2-1</a>
            <a th:href="@{/level2/2}">level2-2</a>
            <a th:href="@{/level2/3}">level2-3</a>
        </p>

        <p sec:authorize="hasRole('vip3')">
            <a th:href="@{/level3/1}">level3-1</a>
            <a th:href="@{/level3/2}">level3-2</a>
            <a th:href="@{/level3/3}">level3-3</a>
        </p>
</body>
</html>